package com.yycx.base.boot.handler;

import com.yycx.common.base.handler.SmsSendHandler;
import com.yycx.common.utils.DateUtils;
import com.yycx.msg.client.model.SmsMessage;
import com.yycx.msg.provider.sms.SmsSender;
import com.yycx.msg.provider.service.impl.AliyunSmsSenderImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author flyme
 * @date 2019/8/21 15:38
 */
@Component("wanLeMeSmsHandler")
public class WanLeMeSmsHandler implements SmsSendHandler {

    @Autowired
    private SmsSender smsSender;

    @Override
    public void send(String mobile, Integer code, String areaCode) {
        SmsMessage smsNotify = new SmsMessage();
        smsNotify.setPhoneNum(mobile);
        smsNotify.setSignName("目鹿选材");
        smsNotify.setTplCode("SMS_175573164");
        smsSender.send(smsNotify);
    }

    @Override
    public void sendSms(String mobile, String tplCode, Map<String, Object> params) {

    }


    public void companyAuthSuccess(String mobile, String shopName, String accountName, String loginpwd) {
        SmsMessage smsNotify = new SmsMessage();
        smsNotify.setPhoneNum(mobile);
        smsNotify.setSignName("玩了么商城");
        smsNotify.setTplCode("SMS_182535040");
        smsNotify.add("shopName", shopName);
        smsNotify.add("submittime", DateUtils.getDateTime());
        smsNotify.add("accountName", accountName);
        smsNotify.add("loginpwd", loginpwd);
        smsSender.send(smsNotify);
    }


    public static void main(String[] args) {
        AliyunSmsSenderImpl aliyunSmsSender = new AliyunSmsSenderImpl();
        SmsMessage smsNotify = new SmsMessage();
        smsNotify.setPhoneNum("17703715373");
        smsNotify.setSignName("目鹿选材");
        smsNotify.setTplCode("SMS_175583180");
        smsNotify.add("content", "图片不合规");
        smsNotify.add("tel", "0755-27904406");
        aliyunSmsSender.send(smsNotify);
    }
}
